{% extends 'base_jgdw.html' %}
{% load staticfiles %}
{% block css %}
    <style>
        h3 {
            color: #c64743
        }
    </style>
{% endblock %}
{% block title %}
    <title>编辑（完善）个人信息</title>
{% endblock %}
{% block body %}
    <div class="container">
        <form class="form-horizontal" role="form" novalidate method="post" onsubmit="return myfun()">
            <h3>编辑（完善）个人信息</h3>
            {% csrf_token %}
            <!--基本信息-->
            <div class="row">
                <div class="panel panel-info">
                    <div class="panel-heading" data-toggle="collapse" data-parent="#accordion" href="#collapse1">
                        编辑（完善）个人信息
                    </div>
                    <div id="collapse1" class="panel-collapse collapse in">
                        <div class="panel-body">


                            <!-- 姓名 -->
                            <div class="form-group col-md-3 {% if obj.name.errors.0 %}has-error{% endif %}">
                                <label for="id_name">{{ obj.name.label }}</label>
                                {{ obj.name }}
                                <span class="help-block">{{ obj.name.errors.0 }}</span>
                            </div>
                            <!-- 手机号码 -->
                            <div class="form-group col-md-3 {% if obj.phone.errors.0 %}has-error{% endif %}">
                                <label for="id_phone">{{ obj.phone.label }}</label>
                                {{ obj.phone }}
                                <span class="help-block">{{ obj.phone.errors.0 }}</span>
                            </div>

                            <!-- 身份证号码 -->
                            <div class="form-group col-md-3 {% if obj.sfzhm.errors.0 %}has-error{% endif %}">
                                <label for="id_sfzhm">{{ obj.sfzhm.label }}</label>
                                {{ obj.sfzhm }}
                                <span class="help-block">{{ obj.sfzhm.errors.0 }}</span>
                            </div>
                            <!-- 密码 -->
                            <div class="form-group col-md-3 {% if obj.password.errors.0 %}has-error{% endif %}">
                                <label for="id_password">{{ obj.password.label }}</label>
                                {{ obj.password }}
                                <span class="help-block">{{ obj.password.errors.0 }}</span>
                            </div>
                            <!-- 询问人 -->
                            <div class="form-group col-md-3 {% if obj.xueli.errors.0 %}has-error{% endif %}">
                                <label for="id_xueli">{{ obj.xueli.label }}</label>
                                {{ obj.xueli }}
                                <span class="help-block">{{ obj.xueli.errors.0 }}</span>
                            </div>
                            <!-- 是否专业军人 -->
                            <div class="form-group col-md-3 {% if obj.junren.errors.0 %}has-error{% endif %}">
                                <label for="id_junren">{{ obj.junren.label }}</label>
                                {{ obj.junren }}
                                <span class="help-block">{{ obj.junren.errors.0 }}</span>
                            </div>
                            <!-- 是否法律专业 -->
                            <div class="form-group col-md-3 {% if obj.falv.errors.0 %}has-error{% endif %}">
                                <label for="id_falv">{{ obj.falv.label }}</label>
                                {{ obj.falv }}
                                <span class="help-block">{{ obj.falv.errors.0 }}</span>
                            </div>
                            <!-- 是否有执法证 -->
                            <div class="form-group col-md-3 {% if obj.zfz.errors.0 %}has-error{% endif %}">
                                <label for="id_zfz">{{ obj.zfz.label }}</label>
                                {{ obj.zfz }}
                                <span class="help-block">{{ obj.zfz.errors.0 }}</span>
                            </div>
                            <!-- 省辖市 -->
                            <div class="form-group col-md-3 {% if obj.xzqh.errors.0 %}has-error{% endif %}">
                                <label for="id_xzqh">{{ obj.xzqh.label }}</label>
                                {{ obj.xzqh }}
                                <span class="help-block">{{ obj.xzqh.errors.0 }}</span>
                            </div>
                            <!-- 单位 -->
                            <div class="form-group col-md-3 {% if obj.organization.errors.0 %}has-error{% endif %}">
                                <label for="id_organization">{{ obj.organization.label }}</label>
                                {{ obj.organization }}
                                <span class="help-block">{{ obj.organization.errors.0 }}</span>
                            </div>
                            <!-- 编制类型 -->
                            <div class="form-group col-md-3 {% if obj.bzlx.errors.0 %}has-error{% endif %}">
                                <label for="id_bzlx">{{ obj.bzlx.label }}</label>
                                {{ obj.bzlx }}
                                <span class="help-block">{{ obj.bzlx.errors.0 }}</span>
                            </div>
                            <!-- 工资保障 -->
                            <div class="form-group col-md-3 {% if obj.gzbz.errors.0 %}has-error{% endif %}">
                                <label for="id_gzbz">{{ obj.gzbz.label }}</label>
                                {{ obj.gzbz }}
                                <span class="help-block">{{ obj.gzbz.errors.0 }}</span>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <div class="col-md-6 col-md-offset-3" style="text-align: center;margin-top: 20px">
                <input type="reset" value="重置" class="btn btn-info">
                <input type="submit" value="提交" class="btn btn-success">
            </div>
        </form>
    </div>
{% endblock %}
{% block js %}
    <script>
        $('#id_xzqh').change(function () {
            $.ajax({
                url: "/hqdw/" + $(this).val() + "/",
                dataType: "json",
                success: function (d) {
                    if (d.n == 200) {
                        $("#id_organization").empty()
                        $.each(d.data, function (i, n) {
                            $("#id_organization").append('<option value="' + n[0] + '">' + n[1] + '</option>')
                        })
                    }

                }
            })
        })
    </script>
{% endblock %}